<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/3/28
 * Time: 18:58
 */
ini_set('session.gc_maxlifetime', "3600"); // 秒
ini_set("session.cookie_lifetime","3600"); // 秒
session_start();
//此处简单的实现一个自动加载
spl_autoload_register(function($class){
    include_once ("./".$class.".class.php");
});

$appID = "wx94010b1eb2f5362d";
$appsecret = "51ac1f02b2cc1c5a643c85f908acb680";


$wxSdk = new WinxinSdk($appID,$appsecret);
$wxSdk->getToken();

//echo WinxinSdk::$access_token;


//测试自定义菜单开始
//自定义菜单
//$menu='{
//    "button": [
//        {
//            "type": "click",
//            "name": "文涛",
//            "key": "V1001_TODAY_MUSIC"
//        },
//        {
//            "name": "菜单1",
//            "sub_button": [
//                {
//                    "type": "view",
//                    "name": "搜12",
//                    "url": "http://www.soso.com/"
//                },
//                {
//                    "type": "click",
//                    "name": "赞一下21",
//                    "key": "V1001_GOOD"
//                }
//            ]
//        }
//    ]
//}';
//echo $wxSdk->customMenu($menu);
//测试自定义菜单结束

//测试用户授权开始
//1.获取code
//$redirect_uri = "http://www.cc8w.com/weixin/oauth2.php";
//$code = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=$appID&redirect_uri=$redirect_uri&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
//header("Location: ".$code);
//exit;
//第二步已经跳转到 oauth2.php去执行了
//测试用户授权结束

//测试二维码开始
var_dump($wxSdk->getQR());
//测试二维码结束